Summary Field Control Configuration
This control is designed to facilitate running SQL Scalar functions for particular asset category.
However, there are some restrictions in defining the function, which are as follows:
1. Function name in should always start with "fnMYD_".
2. Function can and must have following parameters only.
Parameter Name |
Type |
@CategoryIdentifier |
varchar |
@CurrentTableName |
varchar |
@ArchiveTableName |
varchar |
@UniqueID |
int |
@ArchiveTimestamp |
DateTime |
3. Format type in configuration window is to format the outcome of SQL function, here you just need to specify "FORMAT SPECIFIER".
List of format specifier’s can be refereed from http://msdn.microsoft.com/en-us/library/0c899ak8.aspx
Standard Date and Time format strings: http://msdn.microsoft.com/en-us/library/az4se3k1.aspx
Example of Summary field Scalar function:
CREATE FUNCTION dbo.fnMYD_Test(@CategoryIdentifier varchar(50), @CurrentTableName varchar(50), @ArchiveTableName varchar(50), @UniqueID int, @ArchiveTimestamp datetime)
RETURNS int
AS
BEGIN
--Specify function SQL queries in this section
DECLARE @ret int;
SELECT @ret = (pavementURR * 2) FROM SealedRoads
-- Return output
RETURN @ret;
END;
GO
Usage of this Control:
This control is only available on Summary Tab on myData application. Initially it will be hidden but to visualise it one needs to.
1. Right click on empty space of Summary tab and use Customize function.
2. Window will appear from where you can drag Summary Field Configuration control to choice of your location on summary tab.
3. Click “Edit Fields”.
4. Summary Field Configuration window will appear; where you can enter custom fields and related SQL Scalar function name to execute.
Field(s) Description:
-
Field Name: Display field.
-
Function Name: Name of Function you like execute.
-
Format String: format specifier for the result. eg. c2 for formatting result value to Currency up to 2 decimal points.
Sample: Fleet Expiry Fields
Fleet makes great use of this feature by having several reminder fields
Sample Configuration
How they look in the database: